/// @Classname : HcAvatarPage
/// @Author :
/// @Time : 2023-09-07 16:40
/// @Description : //todo

import 'package:flutter/material.dart';
import 'package:hc_ui/config/hc_customer_config.dart';
import 'package:hc_ui/theme/hc_common_theme.dart';
import 'package:hc_ui/utils/hc_gradient_util.dart';
import 'package:hc_ui/widget/avatar/hc_avatar.dart';
import 'package:hc_ui/widget/avatar_group/hc_avatar_grid_group.dart';
import 'package:hc_ui/widget/avatar_group/hc_avatar_stack_group.dart';
import 'package:hc_ui/widget/cell/hc_avatar_cell.dart';
import 'package:hc_ui/widget/title/hc_title.dart';

class HcAvatarPage extends StatefulWidget {
  const HcAvatarPage({Key? key}) : super(key: key);

  @override
  State<HcAvatarPage> createState() => _HcAvatarPageState();
}

class _HcAvatarPageState extends State<HcAvatarPage> {
  HcCommonTheme theme = HcCustomerConfig().allTheme.commonTheme;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: theme.fillPageColor,
      appBar: AppBar(
        title: const Text("头像组件预览 "),
      ),
      body: ListView(
        padding: EdgeInsets.symmetric(
            vertical: theme.vSpacingPage, horizontal: theme.hSpacingPage),
        children: [
          HcTitle.dot(
            title: "基础配置",
          ),
          GridView(
            shrinkWrap: true,
            physics: const NeverScrollableScrollPhysics(),
            gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
                crossAxisCount: 4),
            children: [
              Column(
                children: [
                  HcAvatar(
                    foregroundImageUrl: 'assets/images/icon.jpeg',
                  ),
                  Text("圆形")
                ],
              ),
              Column(
                children: [
                  HcAvatar(
                    foregroundImageUrl: 'assets/images/icon.jpeg',
                    radius: 0,
                  ),
                  Text("矩形")
                ],
              ),
              Column(
                children: [
                  HcAvatar(
                    boxShadow: [
                      BoxShadow(
                          color: Colors.purple.shade50,
                          offset: const Offset(2, 5))
                    ],
                    foregroundImageUrl: 'assets/images/icon.jpeg',
                  ),
                  Text("阴影")
                ],
              ),
              Column(
                children: [
                  HcAvatar(
                    borderColor: Colors.amber,
                    borderWidth: 3.0,
                    foregroundImageUrl: 'assets/images/icon.jpeg',
                  ),
                  Text("边框")
                ],
              ),
              Column(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  HcAvatar(
                    size: 24,
                    radius: 4,
                    foregroundImageUrl: 'assets/images/icon.jpeg',
                  ),
                  Text("变化大小-24")
                ],
              ),
              Column(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  HcAvatar(
                    size: 32,
                    radius: 8,
                    foregroundImageUrl: 'assets/images/icon.jpeg',
                  ),
                  Text("变化大小-32")
                ],
              ),
              Column(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  HcAvatar(
                    size: 40,
                    radius: 16,
                    foregroundImageUrl: 'assets/images/icon.jpeg',
                  ),
                  Text("变化大小-40")
                ],
              ),
              Column(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  HcAvatar(
                    radius: 32,
                    size: 48,
                    foregroundImageUrl: 'assets/images/icon.jpeg',
                  ),
                  Text("变化大小-48")
                ],
              ),
            ],
          ),
          const HcTitle.dot(
            title: "特殊用法",
          ),
          Wrap(
            spacing: 8,
            runSpacing: 8,
            children: [
              Column(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  HcAvatar(
                    foregroundImageUrl: 'assets/images/i1con.jpeg',
                    backgroundImageUrl: 'assets/images/used.png',
                  ),
                  Text(
                    "前景图片报错展示背景图",
                    textAlign: TextAlign.center,
                  )
                ],
              ),
              Column(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: const [
                  HcAvatar(
                    name: '张三',
                  ),
                  Text(
                    "纯色背景+内容为文字 ",
                    textAlign: TextAlign.center,
                  )
                ],
              ),
              Column(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: const [
                  HcAvatar(
                    backgroundImageUrl: 'assets/images/icon.jpeg',
                    name: "lisa zhao",
                  ),
                  Text(
                    "背景图片+文字",
                    textAlign: TextAlign.center,
                  )
                ],
              ),
              Column(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  HcAvatar(
                    gradient: HcGradientUtil.generateLinearGradient(
                        colors: [Colors.purple, Colors.black12]),
                    child: const Icon(Icons.icecream_outlined),
                    // backgroundImageUrl: 'assets/images/icon.jpeg',
                  ),
                  const Text(
                    "渐变背景+Icon",
                    textAlign: TextAlign.center,
                  )
                ],
              ),
            ],
          ),
          HcTitle.dot(
            title: "堆叠头像组",
          ),
          HcAvatarStackGroup(
              avatarList: [
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg')
              ],
              reverse: false,
              borderColor: Colors.white,
              borderWidth: 2,
              showMoreIcon: true),
          const HcTitle.dot(
            title: "宫格头像组",
          ),
          Wrap(
            runSpacing: 8,
            spacing: 8,
            children: [
              HcAvatarGridGroup(size: 48, avatarList: [
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg')
              ]),
              HcAvatarGridGroup(size: 48, avatarList: [
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
              ]),
              HcAvatarGridGroup(size: 48, avatarList: [
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
              ]),
              HcAvatarGridGroup(size: 48, avatarList: [
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
              ]),
              HcAvatarGridGroup(size: 48, avatarList: [
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
              ]),
              HcAvatarGridGroup(size: 48, avatarList: [
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
              ]),
              HcAvatarGridGroup(size: 48, avatarList: [
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
              ]),
              HcAvatarGridGroup(size: 48, avatarList: [
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
              ]),
              HcAvatarGridGroup(size: 48, avatarList: [
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
              ]),
              HcAvatarGridGroup(size: 48, avatarList: [
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
                HcAvatarItem(foregroundImageUrl: 'assets/images/icon.jpeg'),
              ]),
            ],
          ),
          const HcTitle.dot(
            title: "头像单元格",
          ),
          HcAvatarCell(
            title: "大小为24",
            subtitle: "副标题",
            avatarSize: 24,
            avatarName: "张三",
          ),
          HcAvatarCell(
            title: "大小为32",
            subtitle: "副标题",
            avatarSize: 32,
            avatarName: "张三风",
          ),
          HcAvatarCell(
            title: "大小为40",
            subtitle: "副标题",
            avatarSize: 40,
            avatarName: "张三烦烦烦",
          ),
          HcAvatarCell(
              title: "大小为48",
              subtitle: "副标题",
              avatarSize: 48,
              avatarName: "lisa zhang"),
          HcAvatarCell(
            title: "大小为56",
            subtitle: "副标题",
            avatarSize: 56,
            avatarName: "lisa lisa zisa ",
          ),
        ],
      ),

      // floatingActionButton: FloatingActionButton(
      //   onPressed: _incrementCounter,
      //   tooltip: 'Increment',
      //   child: const Icon(Icons.add),
      // ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}
